#ifndef _TASK_
#define _TASK_
#include <iostream>
#include <string>
#include <functional>
//typedef std::function<void(int,std::string&,uint16_t&,std::string&)> func_t;
using func_t = std::function<void (int , const std::string &, const uint16_t &, const std::string &)>;
//套接字sock，ip，port，threadName
class Task
{
public:
    Task()
    {
    }
    Task(int sock, const std::string ip, const uint16_t port, func_t func) : sock_(sock), ip_(ip),port_(port), func_(func)
    {
    }
    void operator()(std::string& name)
    {
        //std::cout << "线程：" << name << "处理结束，结果为 " << x_ << " + " << y_ << " = " << func_(x_, y_) << std::endl;
        func_(sock_,ip_,port_,name);
    }

private:
    int sock_;
    std::string ip_;
    uint16_t port_;
    func_t func_;
};

#endif